package com.empresa.androidchkapp.helpers;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

public class SyncHelper {

	public static String consumirServico(String Uri) {
		HttpClient httpClient = new DefaultHttpClient();
		HttpGet httpGet = new HttpGet(Uri);
		String text = null;

		try {
			HttpResponse response = httpClient.execute(httpGet);

			BufferedReader rd = new BufferedReader(new InputStreamReader(
					response.getEntity().getContent()));

			StringBuffer result = new StringBuffer();
			String line = "";
			while ((line = rd.readLine()) != null) {
				result.append(line);
			}

			text = result.toString();

		} catch (Exception e) {
			e.getLocalizedMessage();
		}
		return text;
	}
	
}
